Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of optuna distributions #268

Merged
merged 3 commits into from
Jun 19, 2024
Merged

Fix usage of optuna distributions #268

merged 3 commits into from
Jun 19, 2024

Conversation

fraimondo
Copy link
Contributor

@fraimondo fraimondo commented Jun 5, 2024

Using something like this:

creator.add(
    "rf",
    C=IntDistribution(low=100, high=400, step=50),
    max_depth=5,
    min_samples_split=2,
    min_samples_leaf=2,
)

Would not work on scikit-learn 1.3, raising the errror:

sklearn.utils._param_validation.InvalidParameterError: The 'n_estimators' parameter of RandomForestClassifier must be an int in the range [1, inf). Got IntDistribution(high=400, log=False, low=100, step=50) instead.

Apparently this is not an issue in the new scikit-learn (or even in the test suit).

This PR fixes that.

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 90.03%. Comparing base (c93ef00) to head (d501297).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #268      +/-   ##
==========================================
- Coverage   90.13%   90.03%   -0.10%     
==========================================
  Files          54       54              
  Lines        2423     2429       +6     
  Branches      491      492       +1     
==========================================
+ Hits         2184     2187       +3     
- Misses        157      159       +2     
- Partials       82       83       +1     
Flag Coverage Δ
docs 100.00% <ø> (ø)
julearn 90.03% <50.00%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
julearn/model_selection/_optuna_searcher.py 83.72% <100.00%> (+1.22%) ⬆️
julearn/pipeline/pipeline_creator.py 86.47% <0.00%> (-0.77%) ⬇️

@fraimondo fraimondo marked this pull request as ready for review June 5, 2024 11:28
@fraimondo fraimondo requested a review from synchon June 5, 2024 11:28
Copy link

github-actions bot commented Jun 5, 2024

PR Preview Action v1.4.7
Preview removed because the pull request was closed.
2024-06-19 16:03 UTC

@fraimondo fraimondo merged commit be6a63b into main Jun 19, 2024
19 of 20 checks passed
@fraimondo fraimondo deleted the fix/optuna_distributions branch June 19, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants